home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / tvcolor.exe / COLORDLG.HPP < prev    next >
C/C++ Source or Header  |  1992-06-27  |  8KB  |  257 lines

  1. /*-----------------------------------------------------------------------*/
  2. /* filename -       colordlg.hpp                                         */
  3. /*                                                                       */
  4. /* function(s)                                                           */
  5. /*                  defines the class TVColorDialog                      */
  6. /*                                                                       */
  7. /*-----------------------------------------------------------------------*/
  8.  
  9. /*-----------------------------------------------------------------------*/
  10. /*                                                                       */
  11. /*    TVColorDialog  -  Version 1.01                                     */
  12. /*                                                                       */
  13. /*    Copyright (C) 1992 Michael Newton and Comsoft Software             */
  14. /*    All Rights Reserved.                                               */
  15. /*                                                                       */
  16. /*-----------------------------------------------------------------------*/
  17.  
  18. /*-----------------------------------------------------------------------*/
  19. /* 06-27-92                                                              */
  20. /* Recompiled COLORDLG.LIB using Borland BC++ ver. 3.1                   */
  21. /*-----------------------------------------------------------------------*/
  22.  
  23.  
  24. // TPatternCluster ********************************************************
  25.  
  26. #if !defined __PATCLUSTER_HPP
  27.  
  28. #define __PATCLUSTER_HPP
  29.  
  30. class far TEvent;
  31. class far TPoint;
  32. class far TRect;
  33. class far TSItem;
  34. class far TStringCollection;
  35.  
  36.  
  37. class TPatternCluster : public TView
  38. {
  39.    public:
  40.       TPatternCluster(const TRect& bounds, TSItem *aStrings);
  41.       ~TPatternCluster();
  42.       virtual ushort dataSize();
  43.       void drawBox(const char *icon, char marker);
  44.       virtual void getData(void *rec);
  45.       virtual void setData(void *rec);
  46.       ushort getHelpCtx();
  47.       virtual TPalette& getPalette() const;
  48.       virtual void handleEvent(TEvent& event);
  49.       virtual Boolean mark(int item);
  50.       virtual void press(int item);
  51.       virtual void movedTo(int item);
  52.       virtual void setState(ushort aState, Boolean enable);
  53.    protected:
  54.       ushort value;
  55.       int sel;
  56.       TStringCollection *strings;
  57.    private:
  58.       int column(int item);
  59.       int findSel(TPoint p);
  60.       int row(int item);
  61.       virtual const char *streamableName() const
  62.                             {
  63.                             return name;
  64.                             };
  65.    protected:
  66.       TPatternCluster(StreamableInit);
  67.       virtual void write(opstream&);
  68.       virtual void *read(ipstream&);
  69.    public:
  70.       static const char * const near name;
  71.       static TStreamable *build();
  72. };
  73.  
  74.  
  75. inline ipstream& operator >> (ipstream& is, TPatternCluster& cl)
  76.    {
  77.    return is >> (TStreamable&) cl;
  78.    };
  79.  
  80. inline ipstream& operator >> (ipstream& is, TPatternCluster*& cl)
  81.    {
  82.    return is >> (void *&) cl;
  83.    };
  84.  
  85. inline opstream& operator << (opstream& os, TPatternCluster& cl)
  86.    {
  87.    return os << (TStreamable&) cl;
  88.    };
  89.  
  90. inline opstream& operator << (opstream& os, TPatternCluster* cl)
  91.    {
  92.    return os << (TStreamable *) cl;
  93.    };
  94.  
  95. #endif                            // End of __PATCLUSTER_HPP
  96.  
  97.  
  98.  
  99. // TPatternButtons ********************************************************
  100.  
  101.  
  102. #if !defined __PATBUTTONS_HPP
  103.  
  104. #define __PATBUTTONS_HPP
  105.  
  106. class far TRect;
  107. class far TSItem;
  108.  
  109. class TPatternButtons : public TPatternCluster
  110. {
  111.    public:
  112.       TPatternButtons(const TRect& bounds, TSItem *aStrings);
  113.       virtual void draw();
  114.       virtual Boolean mark(int item);
  115.       virtual void movedTo(int item);
  116.       virtual void press(int item);
  117.       virtual void setData(void *rec);
  118.       virtual void getData(void *rec);
  119.    private:
  120.       static const char * near button;
  121.       virtual const char *streamableName() const
  122.                             {
  123.                             return name;
  124.                             };
  125.    protected:
  126.       TPatternButtons(StreamableInit);
  127.    public:
  128.       static const char * const near name;
  129.       static TStreamable *build();
  130. };
  131.  
  132.  
  133. inline ipstream& operator >> (ipstream& is, TPatternButtons& cl)
  134.    {
  135.    return is >> (TStreamable&) cl;
  136.    };
  137.  
  138. inline ipstream& operator >> (ipstream& is, TPatternButtons*& cl)
  139.    {
  140.    return is >> (void *&) cl;
  141.    };
  142.  
  143. inline opstream& operator << (opstream& os, TPatternButtons& cl)
  144.    {
  145.    return os << (TStreamable&) cl;
  146.    };
  147.  
  148. inline opstream& operator << (opstream& os, TPatternButtons* cl)
  149.    {
  150.    return os << (TStreamable *) cl;
  151.    };
  152.  
  153. // Inline constructor
  154. inline TPatternButtons::TPatternButtons(const TRect& bounds,
  155.                                         TSItem *aStrings) :
  156.                         TPatternCluster(bounds, aStrings)
  157. {
  158. }
  159.  
  160. #endif                            // End of __PATBUTTONS_HPP
  161.  
  162.  
  163.  
  164. // TVColorDialog **********************************************************
  165.  
  166.  
  167. #if !defined __COLORDLG_HPP
  168.  
  169. #define __COLORDLG_HPP
  170.  
  171. class far TColorGroup;
  172. class far TEvent;
  173. class far TColorDisplay;
  174. class far TColorGroupList;
  175. class far TLabel;
  176. class far TColorSelector;
  177. class far TMonoSelector;
  178. class far TPalette;
  179.  
  180. #define MAXPATTERNS 13
  181.  
  182. class TVColorDialog : public TDialog
  183. {
  184.    public:
  185.       TVColorDialog(TPalette *aPalette,
  186.                     TColorGroup *aGroups,
  187.                     TSItem *items,
  188.                     Boolean addHelpButton = False);
  189.       ~TVColorDialog();
  190.       virtual ushort dataSize();
  191.       virtual void getData(void *rec);
  192.       virtual void setData(void *rec);
  193.       virtual void handleEvent(TEvent& event);
  194.       TPalette *pal;
  195.       TPatternButtons *patSel;
  196.    protected:
  197.       TColorDisplay *display;
  198.       TColorGroupList *groups;
  199.       TLabel *forLabel;
  200.       TColorSelector *forSel;
  201.       TLabel *bakLabel;
  202.       TColorSelector *bakSel;
  203.       TLabel *monoLabel;
  204.       TMonoSelector *monoSel;
  205.       TLabel *patLabel;
  206.    private:
  207.       static const char * near colors;
  208.       static const char * near groupText;
  209.       static const char * near itemText;
  210.       static const char * near forText;
  211.       static const char * near bakText;
  212.       static const char * near textText;
  213.       static const char * near colorText;
  214.       static const char * near okText;
  215.       static const char * near cancelText;
  216.       static const char * near patternText;
  217.       static const char * near helpText;
  218.       virtual const char *streamableName() const
  219.                             {
  220.                             return name;
  221.                             };
  222.    protected:
  223.       TVColorDialog(StreamableInit);
  224.       virtual void write(opstream&);
  225.       virtual void *read(ipstream&);
  226.    public:
  227.       static const char * const near name;
  228.       static TStreamable *build();
  229. };
  230.  
  231.  
  232. inline ipstream& operator >> (ipstream& is, TVColorDialog& cl)
  233.    {
  234.    return is >> (TStreamable&) cl;
  235.    };
  236.  
  237. inline ipstream& operator >> (ipstream& is, TVColorDialog*& cl)
  238.    {
  239.    return is >> (void *&) cl;
  240.    };
  241.  
  242. inline opstream& operator << (opstream& os, TVColorDialog& cl)
  243.    {
  244.    return os << (TStreamable&) cl;
  245.    };
  246.  
  247. inline opstream& operator << (opstream& os, TVColorDialog* cl)
  248.    {
  249.    return os << (TStreamable *) cl;
  250.    }
  251.  
  252.  
  253. #endif                            // End of __COLORDLG_HPP
  254.  
  255. //                                End of __COLORDLG_HPP
  256.  
  257.